Automatic completion of fragments of text

ABSTRACT

A system offers potential completions for fragments of text. The system may obtain a text fragment and identify documents that include the text fragment. The system may locate sentences within the documents that include at least a portion of the text fragment, identify sentence endings associated with the located sentences, and present the sentence endings as potential completions for the text fragment.

RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.13/235,025, filed Sep. 16, 2011, which is a continuation of U.S. patentapplication Ser. No. 12/636,926, filed Dec. 14, 2009 (now U.S. Pat. No.8,024,178), which is a continuation of U.S. patent application Ser. No.10/697,333, filed Oct. 31, 2003 (now U.S. Pat. No. 7,657,423). Theentire disclosures of which are incorporated herein by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates generally to information retrieval systemsand, more particularly, to systems and methods for automaticallycompleting fragments of text (e.g., sentences or paragraphs).

2. Description of Related Art

Oftentimes, people have trouble completing sentences and/or paragraphs.They know what they want to say but they cannot find the appropriatewords to say it. These people may find it beneficial to be offeredpossible completions for sentences and/or paragraphs.

Accordingly, there exists a need for mechanisms that provide possiblecompletions for fragments of text, such as partial sentences and/orparagraphs.

SUMMARY OF THE INVENTION

Systems and methods, consistent with the principles of the invention,automatically complete fragments of text, such as sentences orparagraphs.

According to one aspect consistent with the principles of the invention,a method for completing fragments of text is provided. The method mayinclude obtaining a text fragment and performing a search, based atleast in part on the text fragment, to identify one or more documents.The method may also include identifying sentences within the one or moredocuments that are associated with the text fragment, determiningsentence endings associated with the identified sentences, andpresenting the sentence endings as potential completions for the textfragment.

According to another aspect, a computer device includes a memoryconfigured to store code and a processor configured to execute the codein the memory. The code in the memory may include document preparationcode and assistant code. The document preparation code is configured topermit a user to prepare or edit a document. The assistant code isconfigured to detect a fragment of text within the document, obtainpotential sentence completions for the fragment of text, and present thepotential sentence completions to the user.

According to a further aspect, a computer device includes a memoryconfigured to store instructions and a processor configured to executethe instructions in the memory. The processor may obtain a fragment oftext and search for local documents that include at least a portion ofthe fragment of text. The processor may identify sentences within thelocal documents that are associated with the fragment of text, determinesentence completions associated with the located sentences, and providethe sentence completions as potential completions for the fragment oftext.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, which are incorporated in and constitute apart of this specification, illustrate an embodiment of the inventionand, together with the description, explain the invention. In thedrawings,

FIG. 1 is a diagram of an exemplary network in which systems and methodsconsistent with the principles of the invention may be implemented;

FIG. 2 is an exemplary diagram of a client and/or server of FIG. 1 in animplementation consistent with the principles of the invention;

FIGS. 3A and 3B are flowcharts of exemplary processing for automaticallycompleting a fragment of text according to an implementation consistentwith the principles of the invention; and

FIG. 4 is a diagram of an exemplary ranked list according to animplementation consistent with the principles of the invention.

DETAILED DESCRIPTION

The following detailed description of the invention refers to theaccompanying drawings. The same reference numbers in different drawingsmay identify the same or similar elements. Also, the following detaileddescription does not limit the invention.

Systems and methods consistent with the principles of the invention mayautomatically complete a fragment of text, such as a sentence orparagraph. The systems and methods may identify possible endings fromdocuments, such as web documents, and provide these endings as possiblecompletions for the fragment of text.

Exemplary Network Configuration

FIG. 1 is an exemplary diagram of a network 100 in which systems andmethods consistent with the principles of the invention may beimplemented. Network 100 may include multiple clients 110 connected tomultiple servers 120-140 via a network 150. Network 150 may include alocal area network (LAN), a wide area network (WAN), a telephonenetwork, such as the Public Switched Telephone Network (PSTN), anintranet, the Internet, a memory device, another type of network, or acombination of networks. Two clients 110 and three servers 120-140 havebeen illustrated as connected to network 150 for simplicity. Inpractice, there may be more or fewer clients and servers. Also, in someinstances, a client may perform the functions of a server and a servermay perform the functions of a client.

Clients 110 may include client entities. An entity may be defined as adevice, such as a wireless telephone, a personal computer, a personaldigital assistant (PDA), a lap top, or another type of computation orcommunication device, a thread or process running on one of thesedevices, and/or an object executable by one of these device. Servers120-140 may include server entities that gather, process, search, and/ormaintain documents in a manner consistent with the principles of theinvention. Clients 110 and servers 120-140 may connect to network 150via wired, wireless, and/or optical connections.

In an implementation consistent with the principles of the invention,server 120 may optionally include a search engine 125 usable by clients110. Server 120 may crawl a corpus of documents (e.g., web pages) andstore information associated with these documents in a repository ofcrawled documents. Servers 130 and 140 may store or maintain documentsthat may be crawled by server 120. While servers 120-140 are shown asseparate entities, it may be possible for one or more of servers 120-140to perform one or more of the functions of another one or more ofservers 120-140. For example, it may be possible that two or more ofservers 120-140 are implemented as a single server. It may also bepossible for a single one of servers 120-140 to be implemented as two ormore separate (and possibly distributed) devices.

Exemplary Client/Server Architecture

FIG. 2 is an exemplary diagram of a client or server entity (hereinaftercalled “client/server entity”), which may correspond to one or more ofclients 110 and servers 120-140, according to an implementationconsistent with the principles of the invention. The client/serverentity may include a bus 210, a processor 220, a main memory 230, a readonly memory (ROM) 240, a storage device 250, one or more input devices260, one or more output devices 270, and a communication interface 280.Bus 210 may include one or more conductors that permit communicationamong the components of the client/server entity.

Processor 220 may include any type of conventional processor ormicroprocessor that interprets and executes instructions. Main memory230 may include a random access memory (RAM) or another type of dynamicstorage device that stores information and instructions for execution byprocessor 220. ROM 240 may include a conventional ROM device or anothertype of static storage device that stores static information andinstructions for use by processor 220. Storage device 250 may include amagnetic and/or optical recording medium and its corresponding drive.

Input device(s) 260 may include one or more conventional mechanisms thatpermit an operator to input information to the client/server entity,such as a keyboard, a mouse, a pen, voice recognition and/or biometricmechanisms, etc. Output device(s) 270 may include one or moreconventional mechanisms that output information to the operator,including a display, a printer, a speaker, etc. Communication interface280 may include any transceiver-like mechanism that enables theclient/server entity to communicate with other devices and/or systems.For example, communication interface 280 may include mechanisms forcommunicating with another device or system via a network, such asnetwork 150.

As will be described in detail below, the client/server entity,consistent with the principles of the invention, perform certainsearching-related operations. The client/server entity may perform theseoperations in response to processor 220 executing software instructionscontained in a computer-readable medium, such as memory 230. Acomputer-readable medium may be defined as one or more physical orlogical memory devices and/or carrier waves.

The software instructions may be read into memory 230 from anothercomputer-readable medium, such as data storage device 250, or fromanother device via communication interface 280. The softwareinstructions contained in memory 230 causes processor 220 to performprocesses that will be described later. Alternatively, hardwiredcircuitry may be used in place of or in combination with softwareinstructions to implement processes consistent with the principles ofthe invention. Thus, implementations consistent with the principles ofthe invention are not limited to any specific combination of hardwarecircuitry and software.

Exemplary Processing

FIGS. 3A and 3B are flowcharts of exemplary processing for automaticallycompleting fragments of text, such as sentences and paragraphs,according to an implementation consistent with the principles of theinvention. Processing may begin with server 120 receiving a search queryfrom a user (act 310) (FIG. 3A). For example, a user may useconventional web browser software on client 110 to access search engine125 of server 120. The user may then enter the search query via agraphical user interface provided by server 120.

The search query may take different forms, such as a fragment of text.The text fragment may be associated with a partial sentence, such as“Jane, I have to go because.” Alternatively, the text fragment may beassociated with a partial paragraph, such as “Now we are engaged in agreat civil war, testing whether that nation, or any nation soconceived, and so dedicated, can long endure. We are met on a greatbattle field of that war.” While the description to follow will bedescribed mainly in terms of completing sentences, the description isequally applicable to completing paragraphs.

Server 120 may perform a search for documents that contain the searchquery and retrieve the search results (act 320). For example, server 120may search a corpus or repository of documents to identify documentsthat include the text fragment of the search query as a phrase. Inanother implementation, server 120 may search for documents that alsoinclude synonyms of the word(s) in the search query. In either case, thedocuments may include documents stored by one or more servers, such asservers 120-140. Server 120 may optionally cap the number of documentsincluded in the search results (e.g., server 120 may retrieve the top100 documents). For each of these documents, server 120 may retrieve itstitle and text.

Server 120 may then determine whether there are sufficient searchresults (act 330). For example, server 120 may compare the number ofsearch results retrieved with a threshold (e.g., five). When the numberof search results is less than the threshold, the search results may notbe adequate to satisfy the search query provided by the user. In thiscase, server 120 may form a shortened search query (act 340). Forexample, server 120 may drop one or more words from the search query.

Several techniques exist for determining what word(s) to drop. Forexample according to one implementation, server 120 may simply drop oneor more words from the beginning or end of the search query. Accordingto another implementation, server 120 may drop one or more words basedon one or more symbols, such as a comma, semicolon, bracket, backslash,etc., contained in the search query. For example, if the search queryincludes a comma, then server 120 may drop everything before or afterthe comma. Server 120 may perform similar functions based on othersymbols. According to yet another implementation, server 120 may analyzethe structure of the search query to more intelligently drop one or morewords. For example, server 120 may use a parse tree to identify parts ofthe search query. Server 120 may then drop one or more of these parts.In the sentence example provided above, server 120 may shorten thesearch query to “I have to go because,” dropping “Jane,” from the searchquery.

Server 120 may then perform a search for documents that contain theshortened search query and retrieve the search results (act 320). Asdescribed above, server 120 may search a corpus or repository ofdocuments to identify documents that include the shortened search queryas a phrase. Server 120 may then again determine whether there aresufficient search results (act 330).

When there are sufficient search results (e.g., the number of searchresults is greater than or equal to the threshold), server 120 may scanthe text of the documents in the search results to identify sentencesthat contain the search query (act 350). Server 120 may optionallylocate periods within the documents to identify candidate sentences andthen identify which of the candidate sentences include the search query.The search query may be included at the beginning or elsewhere withinthe identified sentences. Server 120 may give preference to a sentencethat includes the search query at the beginning of the sentence oversentences where the search query occurs elsewhere. Server 120 mayoptionally discard sentences where the search query occurs more thanonce within the same sentences.

For each occurrence of the search query, server 120 may search left andright to determine the rough boundaries of the sentence containing thesearch query. For example, server 120 may look for periods (or otherforms of punctuation) that typically precede and end a sentence. Server120 may be programmed to ignore other typical occurrences of periods(and other forms of punctuation), such as when periods are used forinitials, abbreviations, etc. Server 120 may optionally discardsentences that are missing punctuation and sentences that do not makesense (e.g., do not contain proper sentence structure).

Server 120 may then determine the sentence endings (also called“completions”) associated with the identified sentences (act 360) (FIG.3B). For example, server 120 may identify the word(s) that follow thetext fragment of the search query until the end of the sentence. Server120 may define a quality sentence ending as one that “ends properly,”where “ends properly” is defined as: (1) the word(s) at the end make abetter end of a sentence than they do a beginning of a sentence (e.g.,year and pen); and (2) the last word is not in a list of bad endings(which may be maintained by server 120) (e.g., vs, dr, and aug).

To help in determining whether a word makes a better end of a sentencethan a beginning of a sentence, a set of inverse document frequency(IDF) tables may be generated. IDF refers to a measure of a word'simportance. In this case, two IDF tables may be generated. One table(hereinafter referred to as “start IDF table”) may include uni-grams andbi-grams that are common at the start of sentences. The other table(hereinafter referred to as “end IDF table”) may include uni-grams andbi-grams that are common at the end of sentences. To determine what is“common,” a corpus of documents may be analyzed to identify the textthat occurs around a period. Whether a word makes a better end of asentence may be determined by analyzing the start and end IDF tables.

Server 120 may optionally trim and/or merge the sentence endings (act370). When determining whether to trim a sentence ending, server 120 mayconsider the text and symbols included in the sentence ending. Forexample, server 120 may compare text of the sentence ending to entriesin the start and end IDF tables to determine whether to cut the text.Server 120 may also consider symbols, such as a comma, semicolon,bracket, backslash, etc., when identifying what text to cut. In oneimplementation, server 120 may treat the dash separately, consideringthe text until the dash as a substring and ignoring the text after thedash. Server 120 may also disregard entire sentence endings that containa colon (to avoid noise from message postings). Single word sentenceendings may be considered when the word is significant (e.g., it is acommon ending in the end IDF table). Based on the foregoing, server 120may further consider a sentence ending that: (1) ends properly; and (2)does not separate a preposition (or possessive) from its object.

When determining whether to merge sentence endings, server 120 maysearch for sentence endings that overlap (i.e., sentence endings thathave one or more words in common). Sentence endings may be merged basedon their common parts. When merging sentence endings, server 120 maypermit some small differences between them. For example, the sentenceendings “has four legs and has a tail and barks” and “has four legs anda tail” may be merged to “has four legs and a tail.”

Server 120 may optionally score the sentence endings (act 380). Forexample, server 120 may score the sentence endings by popularity. Inother words, sentence endings that occur more often in the documentsretrieved by the search may be scored higher than sentence endings thatdo not occur as often. Server 120 may alternatively, or additionally,score the sentence endings based on where the text fragment of thesearch query occurs within the identified sentences. In other words, thesentence endings corresponding to sentences where the text fragment ofthe search query occurs at the beginning of the sentences may be scoredhigher than sentence endings corresponding to sentences where the textfragment occurs elsewhere within the sentences. Server 120 may alsopenalize sentence endings for being too long, decreasing their scores.Server 120 may separately consider all of the sentence endings that wereused to create a merged sentence ending when determining the score ofthat sentence ending.

Server 120 may present the sentence endings to the user (act 390). Ifthe sentence endings were scored in some manner, server 120 may organizethe sentence endings into a ranked list that it may provide to the user.In one implementation, server 120 may present an initial group ofsentence endings to the user. The user may then be permitted to cyclethrough subsequent groups in a conventional manner.

FIG. 4 is a diagram of an exemplary ranked list 400 according to animplementation consistent with the principles of the invention. Theexemplary ranked list 400 may include ranked items that each include ascore 410 and a sentence ending (or “completion”) 420. In this example,the user has provide a partial sentence of “I need to go now because.”Server 120 provided various sentence endings that complete the partialsentence. In this example, the top-ranked sentence ending is “I have toget up early tomorrow.”

In another implementation consistent with the principles of theinvention, server 120 may provide sentence endings via a differentinterface. For example, server 120 may operate in conjunction with anapplication, such as a word processing application, an instant messengerapplication, an e-mail application, or another type of application viawhich documents (including messages) are prepared or edited. In anycase, a server assistant, which may be in the form of executable code,such as a plug-in, an applet, a dynamic link library (DLL), or a similartype of executable object or process, resident on client 110, mayoperate to obtain the sentence endings from server 120. For example, theserver assistant may notice text fragments that may require completionand communicate with server 120 to obtain the sentence endings. Theserver assistant may “notice” the text fragments by detecting themautomatically to obtain the sentence endings on-the-fly or by detectingthem when instructed by the user.

According to one implementation, the server assistant may automaticallyinsert one of the sentence endings at the location of the user's cursor.For example, if the user types “I need to go because” and presses aspecial key, the server assistant may complete the sentence byautomatically inserting one of the sentence endings. The user may thenbe permitted to view other possible sentence endings by pressing thespecial key again. Alternatively, subsequent sentence endings may beautomatically presented after expiration of a possibly user-configurableamount of time. According to another implementation, the serverassistant may present the sentence endings via a pop-up window, anothertype of interface, or a combination of interfaces (e.g., a firstpossible sentence ending may be automatically inserted, but subsequentsentence endings may be presented via a pop-up window).

CONCLUSION

Systems and methods consistent with the principles of the invention mayautomatically complete a fragment of text, such as a sentence orparagraph. The systems and methods may identify possible endings fromtext in web documents.

The foregoing description of preferred embodiments of the presentinvention provides illustration and description, but is not intended tobe exhaustive or to limit the invention to the precise form disclosed.Modifications and variations are possible in light of the aboveteachings or may be acquired from practice of the invention. Forexample, while series of acts have been described with regard to FIGS.3A and 3B, the order of the acts may be modified in otherimplementations consistent with the principles of the invention. Also,non-dependent acts may be performed in parallel. Further, while the actsof trimming and merging have been described as preceding the act ofscoring, the scoring act may be performed prior to the trimming and/ormerging acts.

Also, automatic paragraph completion has been described briefly. In oneimplementation, server 120 may provide a separate interface forparagraph completion. In another implementation, server 120 may providethe same interface for sentence and paragraph completion. When searchingfor paragraph endings, server 120 may also look for synonyms of thewords provided in the search query. Server 120 may provide paragraphendings separately from or along with sentence endings. For example,server 120 may score the paragraph endings and the sentence endings andrank them based on their scores. It may be possible for server 120 toprovide paragraph endings instead of sentence endings when server 120finds no (or very few) good sentence endings for the search query.

Further, it has generally been described that server 120 performs most,if not all, of the acts described with regard to the processing of FIGS.3A and 3B. In another implementation consistent with the principles ofthe invention, one or more, or all, of the acts may be performed byclient 110. For example, client 110 may obtain a text fragment andsearch documents local to client 110 (e.g., documents stored by client110 and/or documents stored by a database accessible by client 110) toidentify one or more documents that contain the text fragment. Fromthese documents, client 110 may then identify potential sentencecompletions for the text fragment.

What is claimed is:
 1. A method comprising: identifying, by one or moreprocessors, sentences, within one or more documents, the sentencesincluding text included in a query; determining, by one or moreprocessors and from the identified sentences, completions for the query,the determining including merging similar completions into a singlecompletion; assigning, by the one or more processors, scores to thecompletions based on locations within the identified sentences at whichthe text occurs; and selecting, by one or more processors, a set ofcompletions, of the determined completions, as potential completions forthe query based on the scores.
 2. The method of claim 1, whereidentifying the sentences includes: receiving the query; performing asearch for documents that contain the text included in the query; andidentifying the sentences within the one or more documents based onperforming the search.
 3. The method of claim 1, further comprising:determining that a quantity of the documents that contain the textincluded in the query is less than a threshold; forming a shortenedquery based on the text included in the query when the quantity of thedocuments is less than the threshold; and performing a search fordocuments that contain text in the shortened query.
 4. The method ofclaim 1, where determining the completions includes: locating wordsbetween the text included in the query and ends of the identifiedsentences; and determining the completions based on the located words.5. The method of claim 1, where assigning scores to the completionsfurther comprises: assigning scores to the completions based on aquantity of the one or more documents in which the completions occur. 6.The method of claim 1, further comprising: providing, for presentation,the set of completions as potential completions for the query in anordered list based on the scores.
 7. The method of claim 1, furthercomprising: trimming text from a particular completion of thecompletions prior to assigning the score for the particular completion.8. A system comprising: one or more processors to: identify sentences,within one or more documents, the sentences including text included in aquery; determine, from the identified sentences, completions for thequery, when determining, the one or more processors being to mergesimilar completions into a single completion; assign scores to thecompletions based on locations within the identified sentences at whichthe text occurs; and select a set of completions, of the determinedcompletions, as potential completions for the query based on the scores.9. The system of claim 8, where, when identifying the sentences, the oneor more processors are further to: receive the query; perform a searchfor documents that contain the text included in the query; and identifythe sentences within the one or more documents based on performing thesearch.
 10. The system of claim 8, where the one or more processors arefurther to: determine that a quantity of the documents that contain thetext included in the query is less than a threshold; form a shortenedquery based on the text included in the query when the quantity of thedocuments is less than the threshold; and perform a search for documentsthat contain text in the shortened query.
 11. The system of claim 8,where, when determining the completions, the one or more processors arefurther to: locate words between the text included in the query and endsof the identified sentences; and determine the completions based on thelocated words.
 12. The system of claim 8, where, when assigning scoresto the completions, the one or more processors are further to: assignscores to the completions based on a quantity of the one or moredocuments in which the completions occur.
 13. The system of claim 8,where the one or more processors are further to: provide, forpresentation, the set of completions as potential completions for thequery in an ordered list based on the scores.
 14. The system of claim 8,where the one or more processors are further to trim text from aparticular completion of the completions prior to assigning the scorefor the particular completion.
 15. A non-transitory computer-readablemedium including instructions executable by one or more processors, theinstructions comprising: one or more instructions that, when executed bythe one or more processors, cause the one or more processors to:identify sentences, within one or more documents, the sentencesincluding text included in a query; determine, from the identifiedsentences, completions for the query, the one or more instructions thatcause the one or more processors to determine completions for the queryincluding one or more instructions that cause the one or more processorsto merge similar completions into a single completion; assign scores tothe completions based on locations within the identified sentences atwhich the text occurs; and select a set of completions, of thedetermined completions, as potential completions for the query based onthe scores.
 16. The computer-readable medium of claim 15, where the oneor more instructions that cause the one or more processors to identifythe sentences further include one or more instructions that cause theone or more processors to: receive the query; perform a search fordocuments that contain the text included in the query; and identify thesentences within the one or more documents based on performing thesearch.
 17. The computer-readable medium of claim 15, where theinstructions further comprise: one or more instructions that cause theone or more processors to: determine that a quantity of the documentsthat contain the text included in the query is less than a threshold;form a shortened query based on the text included in the query when thequantity of the documents is less than the threshold; and perform asearch for documents that contain text in the shortened query.
 18. Thecomputer-readable medium of claim 15, where the one or more instructionsthat cause the one or more processors to determine the completionsinclude: one or more instructions that cause the one or more processorsto: locate words between the text included in the query and ends of theidentified sentences; and determine the completions based on the locatedwords.
 19. The computer-readable medium of claim 15, where the one ormore instructions that cause the one or more processors to assign scoresto the completions include: one or more instructions that cause the oneor more processors to assign scores to the completions based on aquantity of the one or more documents in which the completions occur.20. The computer-readable medium of claim 15, where the instructionsfurther comprise: one or more instructions that cause the one or moreprocessors to trim text from a particular completion of the completionsprior to assigning the score for the particular completion.